package com.twu.biblioteca.controllers;


import com.twu.biblioteca.helpers.Encryption;
import com.twu.biblioteca.helpers.InputOutput;
import com.twu.biblioteca.models.UserDAO;

public abstract class Console {

    protected static InputOutput io = InputOutput.getInstance();

    public void run(){
        System.out.println("Output message not implemented!");
    }

    public static final void checkPassword(Console console){
        System.out.println("\nPassword: ");

        String password = io.getInput().nextLine();

        if(UserDAO.checkPassword(new Encryption().encodeSHA(password))){
            console.run();
        }
        else{
            io.getOutput().append("Password incorrect!!! :(\n");
            new ConsoleMainMenu().run();
        }
    }
}
